package com.usian.controller;

import com.usian.User;
import com.usian.feign.SentinelFeign;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("/user")
@RestController
public class SentinelConsumerController {

    @Autowired
    private SentinelFeign sentinelFeign;

    @RequestMapping(value="/feign/{id}",method= RequestMethod.GET)
    public User getUserByFeign(@PathVariable Integer id){
        User user = sentinelFeign.findUserById(id);
        return user;
    }

}
